home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d26 / freetk.arc / LADDER.TK < prev    next >
Text File  |  1987-06-16  |  2KB  |  188 lines

  1. TK!2
  2. =v
  3. #1
  4. :n
  5. h
  6. :v
  7. 10
  8. :s
  9. i
  10. :c
  11. Level of the ladders' crossing point
  12. #2
  13. :n
  14. L1
  15. :v
  16. 40
  17. :s
  18. i
  19. :c
  20. Length of the 1st ladder
  21. #3
  22. :n
  23. L2
  24. :v
  25. 30
  26. :s
  27. i
  28. :c
  29. Length of the 2nd ladder
  30. #4
  31. :n
  32. ya
  33. :s
  34. b
  35. :c
  36. Level of touch point (1st ladder)
  37. #5
  38. :n
  39. yb
  40. :s
  41. b
  42. :c
  43. Level of touch point (2nd ladder)
  44. #6
  45. :n
  46. w
  47. :s
  48. b
  49. :c
  50. Width of the alley
  51. #7
  52. :n
  53. w0
  54. :s
  55. b
  56. :c
  57. Final width vs. first guess ratio
  58. :f
  59. 1
  60. #8
  61. :n
  62. hmax
  63. :s
  64. b
  65. :c
  66. Maximum feasible level h
  67. #10
  68. :n
  69.  
  70. :s
  71. b
  72. :c
  73.     |<------ w ------->|
  74. #11
  75. :n
  76.  
  77. :s
  78. b
  79. :c
  80.   ya|\                 |
  81. #12
  82. :n
  83.  
  84. :s
  85. b
  86. :c
  87.     |  \               |
  88. #13
  89. :n
  90.  
  91. :s
  92. b
  93. :c
  94.     |    \ L1         /|yb
  95. #14
  96. :n
  97.  
  98. :s
  99. b
  100. :c
  101.     |      \     L2 /  |
  102. #15
  103. :n
  104.  
  105. :s
  106. b
  107. :c
  108.     |        \   /     |
  109. #16
  110. :n
  111.  
  112. :s
  113. b
  114. :c
  115.     |         /|\      |
  116. #17
  117. :n
  118.  
  119. :s
  120. b
  121. :c
  122.     |      /   |  \    |
  123. #18
  124. :n
  125.  
  126. :s
  127. b
  128. :c
  129.     |   /     h|    \  |
  130. #19
  131. :n
  132.  
  133. :s
  134. b
  135. :c
  136. ----|/---------|------\|--
  137. =u
  138. =r
  139. #1
  140. :r
  141. "             ********** LADDERS IN THE ALLEY  **********
  142. :s
  143. C
  144. #2
  145. :r
  146. L1^2 = w^2 + ya^2      " There is an alley bounded by two high buildings.
  147. #3
  148. :r
  149. L2^2 = w^2 + yb^2      " Two ladders, L1 and L2 long, rest in corners and
  150. #4
  151. :r
  152. 1/h = 1/ya + 1/yb      " lean against opposite buildings. What is w given h ?
  153. #6
  154. :r
  155. " The Iterative Solver has to be used. Guessing the unknown w usually leads 
  156. :s
  157. C
  158. #7
  159. :r
  160. " to trouble because the interval of feasible guess values is too narrow. 
  161. :s
  162. C
  163. #8
  164. :r
  165. " A reasonable guess depends on the magnitude of L1,L2,h; we may write it as
  166. :s
  167. C
  168. #10
  169. :r
  170.            w/w0 = sqrt(min(L1,L2)^2 - (1/(1/h-1/max(L1,L2)))^2)
  171. #12
  172. :r
  173. " and assign w0=1 as the First guess. Now iteration is invoked automatically
  174. :s
  175. C
  176. #13
  177. :r
  178. " and always converges to a correct solution for any feasible L1,L2,h.
  179. :s
  180. C
  181. #15
  182. :r
  183. 1/hmax = 1/L1 + 1/L2  " This protects against trying too large a value for h:
  184. #16
  185. :r
  186. h = min(h,hmax)       " error in this rule indicates infeasible data.
  187. %Tr,f,0,1,0,1,0
  188.